/**
 * @author spider
 * Created on 28/04/2006
 * Updated on 02/04/2010
 *
 * This class is used to store the information read from xml file
 * (using the method xstream.fromXML()).
 * The class have atributes, getters and setters and does not implements
 * anything else, its purpose is to list all the possible tags that
 * can be found in the xml file.
 */
package br.unb.plugins.geral.model;

import java.awt.GridBagConstraints;
import java.util.ArrayList;

public class XmlComponentModel {

    public static final String FIELD = "FIELD";
    public static final String COMBO = "COMBO";
    public static final String CHECK = "CHECK"; //TODO Implement!!
    public static final String RADIO = "RADIO"; //TODO Implement!!
    public static final String BUTTON = "BUTTON";
    public static final String BOX = "BOX";
    public static final String LABEL = "LABEL";
    private String name;
    private String componentType;
    private String text;
    private String xmlComboPopulator;
    private String action;
    private String alignment;
    private Integer xSize;
    private Integer ySize;
    private ArrayList values;
    private ArrayList validations;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getComponentType() {
        return componentType;
    }

    public void setComponentType(String componentType) {
        this.componentType = componentType;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getXmlComboPopulator() {
        return xmlComboPopulator;
    }

    public void setXmlComboPopulator(String xmlComboPopulator) {
        this.xmlComboPopulator = xmlComboPopulator;
    }

    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;

    }

    public int getAlignment() {
        if (alignment != null) {
            if (alignment.equalsIgnoreCase("EAST")) {
                return GridBagConstraints.EAST;
            } else if (alignment.equalsIgnoreCase("CENTER")) {
                return GridBagConstraints.CENTER;
            } else if (alignment.equalsIgnoreCase("NORTH")) {
                return GridBagConstraints.NORTH;
            } else if (alignment.equalsIgnoreCase("SOUTH")) {
                return GridBagConstraints.SOUTH;
            }
        }
        return GridBagConstraints.WEST;
    }

    public void setAlignment(String alignment) {
        this.alignment = alignment;
    }

    public int getXSizeValue() {
        if (xSize == null) {
            return 10;
        } else {
            return xSize.intValue();
        }
    }

    public String getXSize() {
        return "" + xSize;
    }

    public void setXSize(String size) {

        Integer sz = new Integer(size);
        this.xSize = sz;

    }

    public int getYSizeValue() {
        if (ySize == null) {
            return 5;
        } else {
            return ySize.intValue();
        }
    }

    public String getYSize() {
        return "" + ySize;
    }

    public void setYSize(String size) {

        Integer sz = new Integer(size);
        this.ySize = sz;

    }

    public ArrayList getValues() {
        return values;
    }

    public void setValues(ArrayList values) {
        this.values = values;
    }

    public ArrayList getValidations() {
        return validations;
    }

    public void setValidations(ArrayList validations) {
        this.validations = validations;
    }
}
